import { createBrowserRouter,Navigate } from'react-router-dom';
import main from '../pages/mian';
import home from '../pages/home/index';
import mall from '../pages/mall';
import user from '../pages/user';
import pageOne from '../pages/other/pageone';
import pageTwo from '../pages/other/pagetwo';
import login from '../pages/login'
const routes = [
  {
    path: '/',
    Component: main,
    children: [
      // 重定向
      {
        path: '/',
        element: <Navigate to="home" replace />
      },
      {
        path: 'home',
        Component: home
      },
      {
        path: 'mall',
        Component: mall
      },
      {
        path: 'user',
        Component: user
      },
      {
        path: 'other',
        children: [
          {
            path: 'pageOne',
            Component: pageOne
          },
          {
            path: 'pageTwo',
            Component: pageTwo
          }
        ]
      }
    ]
  },
  {
    path: '/login',
    Component: login
  }
]

export default createBrowserRouter(routes)